package handler

import (
	"net/http"
	"xialou_platform/app/respx"

	"github.com/zeromicro/go-zero/rest/httpx"
	"xialou_platform/services/system/api/internal/logic"
	"xialou_platform/services/system/api/internal/svc"
)

func RoutersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		l := logic.NewRoutersLogic(r.Context(), svcCtx)
		resp, err := l.Routers()
		if err != nil {
			httpx.Error(w, err)
		} else {
			httpx.OkJson(w, respx.NewSuccessResponse(resp))
		}
	}
}
